<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">

    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />


    <link rel="stylesheet" href="../content/css/font.css">
    <link rel="stylesheet" href="../content/css/xadmin.css">
    <link rel="stylesheet" href="../content/plugin/bootstrap/css/bootstrap.min.css">
    <link rel='stylesheet' href='../content/plugin/bootstrap/css/style.css' />


    <link rel="stylesheet" href="../content/plugin/FileUpload/css/jquery.fileupload.css" />
    <script src="../content/plugin/My97DatePicker/WdatePicker.js" charset="utf-8"></script>

<body>
    <div class="x-nav">

        <span class="nav-header">
            <a href="">首页</a>>
            <a href="">系统管理</a>>
            <a>
                <cite>商城设置</cite>
            </a>
        </span>

    </div>
    <div class="col-lg-12 " id="app">
        <div class="ibox float-e-margins">


            <div class="x-body">
                <ul id="myTab" class="nav nav-tabs">
                    <li class="active">
                        <a href="#home" data-toggle="tab">
                            商城设置
                        </a>
                    </li>
                   

                </ul>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade in active" id="home">
                        <div class="x-body">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>系统名称
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" required="" v-model="data.shoptitle" style="width: 300px;"
                                        autocomplete="off" class="layui-input">
                                </div>

                            </div>

                      
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>客服电话
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" required="" v-model="data.phone" autocomplete="off"
                                        class="layui-input">
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>版本信息
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" required="" v-model="data.version" autocomplete="off"
                                        class="layui-input">
                                </div>

                            </div>
                        
                            <div class="layui-form-item">

                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 150px;">
                                    </label>
                                    <button class="layui-btn" v-on:click="save()">
                                        保存
                                    </button>
                                </div>
                            </div>


                        </div>
                    </div>
                    <div class="tab-pane fade" id="xieyi">
                        <div class="x-body">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>日元汇率
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" required="" v-model="data.huilv" autocomplete="off"
                                        class="layui-input">
                                </div>

                            </div>


                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>限购数量
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" required="" v-model="data.limit" autocomplete="off"
                                        class="layui-input">
                                </div>

                            </div>


                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>下单须知
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">


                                    <textarea rows="10" cols="400" v-model="data.xieyi"></textarea>
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>下单须知2
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">

                                    <textarea rows="10" cols="400" v-model="data.xieyi2"></textarea>
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 150px;">
                                </label>
                                <button class="layui-btn" v-on:click="save()">
                                    保存
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="tab-pane fade" id="jifen">
                        <div class="x-body">

                            <div class="layui-form-item">

                                <div class="layui-form-item">
                                    <label for="username" class="layui-form-label" style="width: 150px;">
                                        <span class="x-red">*</span>物流公司
                                    </label>
                                    <div class="layui-input-inline" style="width: 500px;">
                                        <textarea rows="10" cols="200" v-model="data.wuliulist"></textarea>
                                    </div>

                                </div>


                                <div class="layui-form-item">
                                    <label for="username" class="layui-form-label" style="width: 150px;">
                                        <span class="x-red">*</span>件数
                                    </label>
                                    <div class="layui-input-inline" style="width: 500px;">
                                        <input type="text" required="" v-model="data.mailnum" autocomplete="off"
                                            style="height:30px;width: 120px;" />
                                    </div>

                                </div>
                                <div class="layui-form-item">
                                    <label for="username" class="layui-form-label" style="width: 150px;">
                                        <span class="x-red">*</span>价格
                                    </label>
                                    <div class="layui-input-inline" style="width: 500px;">
                                        <input type="text" required="" v-model="data.mailprice" autocomplete="off"
                                            style="height:30px;width: 120px;" />
                                    </div>

                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 150px;">

                                    </label>
                                    <button class="layui-btn" v-on:click="save()">
                                        保存
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="tab-pane fade" id="fenzhang">
                        <div class="x-body">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>用户名
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.sms_username" autocomplete="off"
                                        style="height:30px;width: 120px;" />
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>密码
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.sms_password" autocomplete="off"
                                        style="height:30px;width: 120px;" />
                                </div>

                            </div>

                            <div class="layui-form-item">

                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 150px;">

                                    </label>
                                    <button class="layui-btn" v-on:click="save()">
                                        保存
                                    </button>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="tab-pane fade" id="tag">
                        <div class="x-body">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>内容标签
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <textarea rows="10" cols="200" v-model="data.tags"></textarea>
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>商品标签
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <textarea rows="10" cols="200" v-model="data.goodtags"></textarea>
                                </div>

                            </div>


                            <div class="layui-form-item">

                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 150px;">

                                    </label>
                                    <button class="layui-btn" v-on:click="save()">
                                        保存
                                    </button>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="tab-pane fade" id="kefu">
                        <div class="x-body">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>客服二维码
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">


                                    <img :src="kefuimgurl" style="width: 200px;" />
                                    <span class="btn btn-success fileinput-button">
                                        <i class="glyphicon glyphicon-plus"></i>
                                        <span>添加素材</span>
                                        <input id="fileupload1" type="file" name="imgFile" multiple>

                                    </span>
                                </div>
                                <div class="layui-form-item">
                                    <label for="username" class="layui-form-label" style="width: 150px;">
                                        <span class="x-red">*</span>备注
                                    </label>
                                    <div class="layui-input-inline" style="width: 500px;">
                                        <textarea rows="10" cols="200" v-model="data.kefudesc"></textarea>
                                    </div>

                                </div>

                            </div>


                            <div class="layui-form-item">

                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 150px;">

                                    </label>
                                    <button class="layui-btn" v-on:click="save()">
                                        保存
                                    </button>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="tab-pane fade" id="score">
                        <div class="x-body">

                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>积分比例
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.scorebili" autocomplete="off"
                                        style="height:30px;width: 120px;" />积分=16日元
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>消费
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.xfcheck" autocomplete="off"
                                        style="height:30px;width: 120px;" />元得 <input type="text" required=""
                                        v-model="data.xfcheckscore" autocomplete="off"
                                        style="height:30px;width: 120px;" />积分
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>过审笔记
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.newsokscore" autocomplete="off"
                                        style="height:30px;width: 120px;" /> 积分
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>带图好评
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.haopingimagescore" autocomplete="off"
                                        style="height:30px;width: 120px;" /> 积分
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>仅好评
                                </label>
                                <div class="layui-input-inline" style="width: 500px;">
                                    <input type="text" required="" v-model="data.haopingscore" autocomplete="off"
                                        style="height:30px;width: 120px;" /> 积分
                                </div>

                            </div>
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>积分规则
                                </label>
                                <div class="layui-input-inline">
                                    <textarea rows="10" cols="200" v-model="data.jifencontent"></textarea>
                                </div>

                            </div>
                            <div class="layui-form-item">

                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 150px;">

                                    </label>
                                    <button class="layui-btn" v-on:click="save()">
                                        保存
                                    </button>
                                </div>
                            </div>

                        </div>
                    </div>

                    <div class="tab-pane fade" id="zhekou">
                        <div class="x-body">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>折扣
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" required="" v-model="data.timezhekou" autocomplete="off"
                                        class="layui-input">
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label" style="width: 150px;">
                                    <span class="x-red">*</span>到期时间
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" v-model="data.zhekouendtime" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 150px;">
                                </label>
                                <button class="layui-btn" v-on:click="save()">
                                    保存
                                </button>
                            </div>
                        </div>
                    </div>
                </div>



            </div>



        </div>
    </div>


</body>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<link href="../content/plugin/sweetalert/sweetalert.css" rel="stylesheet">
<script src="../content/plugin/sweetalert/sweetalert.min.js"></script>
<script src="../content/js/vue2.js"></script>
<script src="../content/plugin/bootstrap/js/bootstrap.min.js"></script>

<script src="../content/js/config.js"></script>

<link rel="stylesheet" href="../content/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="../content/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="../content/kindeditor/lang/zh_CN.js"></script>

<script src="../content/plugin/FileUpload/js/vendor/jquery.ui.widget.js"></script>
<script src="../content/plugin/FileUpload/js/jquery.iframe-transport.js"></script>
<script src="../content/plugin/FileUpload/js/jquery.fileupload.js"></script>

<script>
    $(function () {
        'use strict';
        var url = apiurl + "/upload/file";
        $('#fileupload1').fileupload({
            autoUpload: true,//是否自动上传
            url: url,
            dataType: 'json',
            done: function (e, data) {

                console.log(data.result);
                if (data.result.code == 200) {

                    vm.$data.kefuimgurl = data.result.pic;


                } else {
                    swal("上传出错了!", data.result.message, "success");

                }
            },
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .progress-bar').css(
                    'width',
                    progress + '%'
                );
            }
        }).prop('disabled', !$.support.fileInput)
            .parent().addClass($.support.fileInput ? undefined : 'disabled');
    });
    var editor_xieyi;
    var editor_vipdesc;
    var editor_vipczdesc
    var editor_fenzhangxieyi;
    var editor_yonghuxieyi;
    var editor_yinsixieyi;
    // KindEditor.ready(function (K) {
    //     editor_xieyi = K.create('textarea[name="xieyi"]', {
    //         width: '300px',
    //         allowFileManager: false,
    //         uploadJson: "/upload/kimg"
    //     });
    //     editor_fenzhangxieyi = K.create('textarea[name="fenzhangxieyi"]', {
    //         width: '300px',
    //         allowFileManager: false,
    //         uploadJson: "/upload/kimg"
    //     });


    //     editor_vipdesc = K.create('textarea[name="vipdesc"]', {
    //         width: '300px',
    //         allowFileManager: false,
    //         uploadJson: "/upload/kimg"
    //     });
    //     editor_vipczdesc = K.create('textarea[name="vipczdesc"]', {
    //         width: '300px',
    //         allowFileManager: false,
    //         uploadJson: "/upload/kimg"
    //     });
    //     editor_yonghuxieyi = K.create('textarea[name="yonghuxieyi"]', {
    //         width: '300px',
    //         allowFileManager: false,
    //         uploadJson: "/upload/kimg"
    //     });
    //     editor_yinsixieyi = K.create('textarea[name="yinsixieyi"]', {
    //         width: '300px',
    //         allowFileManager: false,
    //         uploadJson: "/upload/kimg"
    //     });


    // });


    var vm = new Vue({
        el: "#app",
        data: {

            data: {
            },
            couponlist: [],
            search: {
                page: 1,
                size: 999,
                bigtype: "app"
            },
            kefuimgurl: "",

        },
        methods: {

            load: function () {

                var _this = this;
                $.post(apiurl + "/admin/config/load", {}, function (_result) {
                    console.log(_result);
                    _this.data = _result.data;
                    _this.kefuimgurl = _result.data.kefuimgurl;

                    // editor_xieyi.html(_result.data.xieyi);
                    // editor_vipdesc.html(_result.data.vipdesc);
                    // editor_vipczdesc.html(_result.data.vipczdesc);
                    // editor_fenzhangxieyi.html(_result.data.fenzhangxieyi);
                    // editor_yonghuxieyi.html(_result.data.yonghuxieyi);
                    // editor_yinsixieyi.html(_result.data.yinsixieyi);

                });

            },
            save: function () {

                var _this = this;
                // this.data.xieyi = editor_xieyi.html();
                // this.data.vipdesc = editor_vipdesc.html();
                // this.data.vipczdesc = editor_vipczdesc.html();
                // this.data.clinicid = clinicid;
                // this.data.fenzhangxieyi = editor_fenzhangxieyi.html();
                // this.data.yonghuxieyi = editor_yonghuxieyi.html();
                // this.data.yinsixieyi = editor_yinsixieyi.html();

                this.data.kefuimgurl = this.kefuimgurl;

                $.post(apiurl + "/admin/config/save", { data: JSON.stringify(this.data) }, function (_result) {

                    swal("success", "保存成功", "success");
                    _this.load();


                });


            },

        },
        created: function () {  //初始化事件里边去调用查询方法
            var self = this;
            setTimeout(() => {
                self.load();
            }, 200);




        }
    });





</script>